#ifndef __OSAL_TIMER_H
#define __OSAL_TIMER_H
#include "OSAL.h"
#include <stdio.h>
#include "OSAL_MSG.h"
#include "stdlib.h"
#include "sys.h"
#include "misc.h"
#include <stdbool.h>
#define OSAL_TIMERMGR_UPDATE 0x0001



typedef struct TimerEntity{
    uint32_t period;   //定时器计数值
    uint32_t counter;   //定时器计数值
    uint8_t taskEvent;  //定时器到后执行的事件
    uint8_t taskID;     //定时器到后执行事件的任务  
    struct TimerEntity * nextTimer;
    bool periodic;      //是否是周期定时器
}Timer;

extern void OSAL_TimerInit(uint8_t taskID);
extern void OSAL_TimerAdd(Timer * TimerEn);
extern void OSAL_TimerDelete(Timer * TimerEn);
extern void OSAL_TimerRunning(void);
extern void OSAL_TimerOneShot(uint8_t taskID, uint16_t taskEvent, uint32_t tickMS);
extern void OSAL_TimerPeriodic(uint8_t taskID, uint16_t taskEvent, uint32_t tickMS);
extern uint8_t OSAL_Timer_ProcessEvents(uint8_t taskID, uint16_t event);
extern void OSAL_timerBaseInit(uint32_t tickMS);
extern void TIM3_Int_Init(u16 arr, u16 psc);
extern void TIM3_IRQHandler(void);



#endif